Field of the Invention
The present invention relates to automatic allocation of IP addresses in a communication apparatus having multiple communication interfaces.
Description of the Related Art
Wireless LAN systems typified by IEEE 802.11 have come into widespread use in recent years.
Such wireless LANs have two modes, namely an infrastructure mode and an adhoc mode. In the infrastructure mode, an infrastructure network is formed by an access point (“AP” below), which manages the wireless network, and a communication terminal (a station or “STA” below), which communicates upon being connected to the wireless network. Data communication by the STA in the infrastructure network is performed via the AP at all times.
With an infrastructure network, communication with a wide-area network (“WAN” below) is possible via the AP. To accomplish this, data communication generally uses routable addresses allocated by a DHCP server within the LAN or by a DHCP server function incorporated within the AP.
The term “routable address” refers to an IP address that is transferable to a router. In a case where a NAT is used, generally an address allocated by the DHCP protocol uses a private address. Addresses 192.168.0.0 to 192.168.255.255 are examples of private addresses utilized in IPv4.
In the adhoc mode, on the other hand, an adhoc network is formed by a STA alone and does not require a device to manage the wireless network. Data communication in an adhoc network is directly carried out between STAs. Further, in an adhoc network, in view of the absence of a device for managing the network, data communication generally uses link-local addresses by Auto IP or private addresses manually.
Here, addresses 169.254.0.0 to 169.254.255.255 are utilized as link-local addresses in IPv4.
Devices capable of operating in both the infrastructure mode and adhoc mode simultaneously and devices capable of functioning as both an AP and a STA simultaneously have been developed in recent years (see Japanese Patent Laid-Open No. 2005-086350). An arrangement that can be adopted for implementing these functions is to individually provide wireless hardware for implementing the respective functions. However, since this results in a commensurate rise in cost, most devices make common use of a single item of wireless hardware for each of the functions.
Generally, in such devices, the infrastructure mode and the adhoc mode or the AP and STA are managed internally as respective ones of separate communication interfaces. Consequently, this makes necessary control similar to that of a device physically having multiple interfaces.
In a case where wireless hardware is shared by a plurality of functions, it is possible to use MAC addresses that differ for each function. However, it is also possible to use a single MAC address. Which method is adopted depends upon the implementation by the vendor that provides the communication interface (or “IF”), and in most cases the selection cannot be made by the set maker, etc., who receives the provision of the communication IF.
Further, the method generally used with such a device is to manage each function as a different communication IF. For example, control is exercised such that the AP function is managed as IF-1, the STA function is managed as IF-2, data to be communicated using the AP function is transmitted to the IF-1 and data to be communicated using the STA function is transmitted to the IF-2.
However, in the case where a single MAC address is used, a situation which arises is that multiple communication interfaces will have the same MAC address. As a consequence, the link-local addresses of IPv4 or IPv6, which are generated based upon a MAC address, become identical.
In a communication apparatus equipped with a plurality of communication interfaces, if the communication application performs data communication via a socket interface, then an IP address is used to designate the communication interface to be used in data communication. However, in a case where IP addresses that have been set for multiple communication interfaces have taken on an identical value, a communication interface cannot be specified uniquely by the IP address. The problem that arises is that data communication may be carried out using an unintended communication interface.
The present invention provides a communication apparatus in which the setting of an identical IP address for multiple communication interfaces can be prevented so that an application will send and receive data via the intended communication interface.